/*
 * Test2
 * 
 * Version information:1.0
 *
 * Date: 19/11/2012
 */

/**
 * @author dv11rlm
 */
public class Test2 implements TestClass {

    // int array.
    private IntArray array;

    /*
     * This function is clearly more important than Test2() thus above
     * Test2(), according to java standard.
     */
    public Test2(int a) {
    }

    public Test2() {
    }

    // set array size to 5 and initialize each positions with 1.
    public void setUp() {
	array = new IntArray(5);
	for (int i = 0; i < array.getSize(); i++) {
	    array.setValueAt(i, 1);
	}
    }

    public void tearDown() {
	array = null;
    }

    // Test that should succeed
    public boolean testAddNumber() {

	int value = 2;
	for (int i = 0; i < array.getSize(); i++) {
	    array.setValueAt(i, value);
	}

	for (int i : array.getArray()) {
	    if (i != value) {
		return false;
	    }
	}
	return true;
    }

    // Test that should fail
    @SuppressWarnings("null")
    public boolean testNullPointerException() {

	Object o = null;
	o.getClass();
	return true;
    }

    // Test that should succeed
    public boolean testShouldWork() {
	return true;
    }

    // Test that should fail
    public boolean testShouldNotWork() {
	return false;
    }

    // Test that should succeed
    public boolean testChangeValue() {
	int value = 2;
	for (int i = 0; i < array.getSize(); i++) {
	    array.setValueAt(i, value);
	}
	array.setValueAt(0, 7);
	for (int j : array.getArray()) {
	    if (array.getIntegerAtPosition(0) < j) {
		return false;
	    }
	}
	return true;
    }
}
